home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / var / lib / dpkg / info / dhcp3-client.preinst < prev    next >
Text File  |  2009-10-08  |  3KB  |  99 lines

  1. #!/bin/sh
  2.  
  3. set -e
  4.  
  5. # Prepare to remove a no-longer used conffile
  6. prep_rm_conffile()
  7. {
  8.     PKGNAME="$1"
  9.     CONFFILE="$2"
  10.  
  11.     if [ -e "$CONFFILE" ]; then
  12.         md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  13.         old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE'{s/ obsolete$//;s/.* //p}\"`"
  14.         if [ "$md5sum" != "$old_md5sum" ]; then
  15.             echo "Obsolete conffile $CONFFILE has been modified by you, renaming to .dpkg-bak"
  16.             mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
  17.         else
  18.             mv -f "$CONFFILE" "$CONFFILE".dpkg-obsolete
  19.         fi
  20.     fi
  21. }
  22.  
  23. case "$1" in
  24.     install|upgrade)
  25.         # if the /etc/dhclient.conf from dhcp-client was modified, 
  26.     # bring it forward to /etc/dhcp3/dhclient.conf, but in a way not
  27.     # to upset dpkg about a changed conffile
  28.         if [ ! -e /etc/dhcp3/dhclient.conf ] && [ -e /etc/dhclient.conf ] && \
  29.         ! >/dev/null 2>&1 md5sum -c - <<-EOF; then
  30.         10830c7543724cfd36f10dd87a5f98eb  /etc/dhclient.conf
  31.         EOF
  32.         mkdir -p /etc/dhcp3
  33.         cp /etc/dhclient.conf /etc/dhcp3/dhclient.conf.oldconfig
  34.         fi
  35.  
  36.     # We renamed debug-enter to debug - handle the transition
  37.     if [ ! -e /etc/dhcp3/dhclient-enter-hooks.d/debug ] && \
  38.           [ -e /etc/dhcp3/dhclient-enter-hooks.d/debug-enter ]; then
  39.         mv /etc/dhcp3/dhclient-enter-hooks.d/debug-enter \
  40.            /etc/dhcp3/dhclient-enter-hooks.d/debug
  41.     else
  42.         rm -f /etc/dhcp3/dhclient-enter-hooks.d/debug-enter
  43.     fi
  44.  
  45.     # We renamed debug-exit to debug - handle the transition
  46.     if [ ! -e /etc/dhcp3/dhclient-exit-hooks.d/debug ] && \
  47.           [ -e /etc/dhcp3/dhclient-exit-hooks.d/debug-exit ]; then
  48.         mv /etc/dhcp3/dhclient-exit-hooks.d/debug-exit \
  49.            /etc/dhcp3/dhclient-exit-hooks.d/debug
  50.     else
  51.         rm -f /etc/dhcp3/dhclient-exit-hooks.d/debug-exit
  52.     fi
  53.  
  54.     # We moved /etc/dhcp3/dhclient-script to /sbin in 3.0.4-2
  55.     if dpkg --compare-versions "$2" lt-nl "3.0.4-2"; then
  56.         if [ -e /etc/dhcp3/dhclient-script ]; then
  57.             if >/dev/null 2>&1 md5sum -c - <<-EOF; then
  58.             2b18b5c59b26d00aa115716b3da2ed26  /etc/dhcp3/dhclient-script
  59.             EOF
  60.                 rm -f /etc/dhcp3/dhclient-script
  61.             fi
  62.         fi
  63.     fi
  64.  
  65.     if dpkg --compare-versions "$2" lt-nl 3.1.2-1ubuntu7; then
  66.         prep_rm_conffile dhcp3-client /etc/network/if-pre-up.d/dhclient3-apparmor
  67.     fi
  68.  
  69.         ;;
  70.  
  71.     abort-upgrade)
  72.         ;;
  73.  
  74.     *)
  75.         echo "preinst called with unknown argument \`$1'" >&2
  76.         exit 1
  77.     ;;
  78. esac
  79.  
  80. APP_PROFILE="sbin.dhclient3"
  81. APP_CONFFILE="/etc/apparmor.d/$APP_PROFILE"
  82. APP_COMPLAIN="/etc/apparmor.d/force-complain/$APP_PROFILE"
  83. if [ "$1" = "upgrade" ]; then
  84.     mkdir -p `dirname $APP_COMPLAIN` 2>/dev/null || true
  85.     if dpkg --compare-versions $2 lt "3.0.4-12ubuntu4" ; then
  86.         # force-complain for pre-apparmor upgrades
  87.         ln -sf $APP_CONFFILE $APP_COMPLAIN
  88.     fi
  89. fi
  90.  
  91. # dh_installdeb will replace this with shell code automatically
  92. # generated by other debhelper scripts.
  93.  
  94.  
  95.  
  96. exit 0
  97.  
  98.  
  99.